package com.redhat.auth.web.account;

import java.util.ArrayList;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import com.dayatang.domain.InstanceFactory;
import com.dayatang.querychannel.service.QueryChannelService;
import com.redhat.auth.application.AccountApplication;
import com.redhat.auth.domain.Account;
import com.redhat.auth.domain.BizSystem;
import com.redhat.redwork.widget.grid.AbstractGridModel;
import com.redhat.redwork.widget.grid.Order;

@Component
/**
 * 系统绑定帐号功能--绑定帐号Grid
 */
public class SystemAccountBindingGridModel extends
		AbstractGridModel<Account, Account> {

	private long count;

	@Autowired
	private AccountApplication accountApplication;

	
	public AccountApplication getAccountApplication() {
		return accountApplication;
	}

	public void setAccountApplication(AccountApplication accountApplication) {
		this.accountApplication = accountApplication;
	}

	@Override
	public Long count(Account search) {
		return count;
	}

	@Override
	public Account getCriteriaObject() {
		return new Account();
	}

	@Override
	public List<Account> list(Account search, int page, int pageSize,
			Order order) {
		List<Account> accounts = accountApplication.listAccountNotContainsSystemId(search, page, pageSize);
		setCount(accounts==null?0:accounts.size());
		return accounts;
	}

	public long getCount() {
		return count;
	}

	public void setCount(long count) {
		this.count = count;
	}
}
